#include "label.h"
#include <QMouseEvent>
#include <QtDebug>
label::label(QWidget* parent) : QLabel(parent)
{

}

void label::mousePressEvent(QMouseEvent *ev)
{
    if(ev->button() == Qt::LeftButton)
    {
        qDebug() << "按下的鼠标左键";
        qDebug() << ev->x() << " " << ev->y();
    }
    else if(ev->button() == Qt::RightButton)
    {
        qDebug() << "按下的鼠标右键";
        qDebug() << ev->x() << " " << ev->y();
    }
    qDebug() << ev->globalX() << " " << ev->globalY();
}

void label::mouseDoubleClickEvent(QMouseEvent *event)
{
    qDebug() << "触发双击事件";
}

void label::mouseReleaseEvent(QMouseEvent *event)
{
    qDebug() << "释放按键";
}
